property

abstract fun <T> property(name: String): Optional<T>

Returns an Optional describing the value of the JavaScript object's property with the given name or an empty Optional if there is no such property or its value is undefined.

The type mapping rules are the following:

| JavaScript         | Java           |
|--------------------|----------------|
| Number             | Double         |
| BigInt             | BigInteger     |
| String             | String         |
| Boolean            | Boolean        |
| Symbol             | JsSymbol       |
| null and undefined | null           |
| Node               | JsObject, Node |
| ArrayBuffer        | JsArrayBuffer  |
| Array              | JsArray        |
| Set                | JsSet          |
| Map                | JsMap          |
| Object             | JsObject       |
| Proxy Object       | Object         |

Proxy objects are mapped to the corresponding injected Java object.

Return

an Optional describing the value of the JavaScript object's property with the given name. If the object does not have this property or the property value is null or undefined, the method returns an empty Optional

Parameters

<T>

the result type according to the type mapping rules

name

a string that represents the name of the property or function

See also

Throws

when name is empty or blank

when the JavaScript object is already disposed or invalid


abstract fun <T> property(jsSymbol: JsSymbol): Optional<T>

Returns an Optional describing the value of the JavaScript object's property with the given jsSymbol key or an empty Optional if there is no such property or its value is undefined.

Return

an Optional describing the value of the JavaScript object's property with the given jsSymbol key. If the object does not have this property or the property value is null or undefined, the method returns an empty Optional

Since

8.13.0

Parameters

<T>

the result type according to the type mapping rules

jsSymbol

a symbol that represents the property key

See also

Throws

when jsSymbol is from a different web page or frame

when the JavaScript object or jsSymbol is already disposed or invalid